/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.cezary.butler.walili.common;

import java.net.URL;
import javax.activation.MimetypesFileTypeMap;

/**
 *
 * @author Czarek
 */
public class MimeTypeGuesser {
    private static final MimetypesFileTypeMap map;
    
    static{
        map = (MimetypesFileTypeMap) MimetypesFileTypeMap.getDefaultFileTypeMap();
        map.addMimeTypes("audio/mpeg3           mp3 MP3");
        //map = (MimetypesFileTypeMap) MimetypesFileTypeMap.getDefaultFileTypeMap();
    }
    
    public String guessMimeType(URL url){
        if(url!=null)
            return map.getContentType(url.getFile());
        else
            return null;
    }
}
